package com.dealglobe.feeder.bvd.query;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public final class Utils {
    
    public static String readFromResource(String resourceName) {
        String text = null;
        BufferedReader br = null;
        try {
            InputStream in = BvdQuery.class.getResourceAsStream(resourceName);
            br = new BufferedReader(new InputStreamReader(in));
            String         line = null;
            StringBuilder  stringBuilder = new StringBuilder();
            while( ( line = br.readLine() ) != null ) {
                stringBuilder.append( line);
            }
            text = stringBuilder.toString();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
        return text;
    }

}
